package com.onstar.cn.weight;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;

/**
 * Created by 6335yz on 2016/7/8.
 */
public class BlockHorScrollView extends ScrollView {

    public BlockHorScrollView(Context context) {
        super(context);
    }

    public BlockHorScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public BlockHorScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    private float x;
    private float delta = 8;

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (Math.abs(ev.getX() - x) > delta) {
            return true;
        }else {
            return super.onInterceptTouchEvent(ev);
        }
    }
}
